﻿@model IEnumerable<CREAPA.Dominio.Portaria>

@{

    ViewBag.Title = "Index";
}
<script src="~/Scripts/AlertaPersonalizado.js"></script>

<h2>Portarias Pendentes de Análise (@ViewBag.TotalPortaria)</h2>

@{
    if (TempData["AnalisePortaria"] != null)
    {
        TempData["AnalisePortaria"] = null;
        <body onload="Alert.render('Portaria Analisada com sucesso')">
 <div id="dialogoverlay"></div>
 <div id="dialogbox"><div>
 <div id="dialogboxhead"></div>
 <div id="dialogboxbody"></div>
 <div id="dialogboxfoot"></div>
 </div>
 </div>
 </body>
  }
}

@if (ViewBag.TotalPortaria > 0){

    WebGrid grid = new WebGrid(source: Model, columnNames: new string[] { "Id", "PessoaCadastrou", "DataPortaria", "Numero", "Ano", "TipoPortaria", "Analisado_Superintendencia", "Analisado_Presidencia", "DescricaoAnalise", "Ver" }, canPage: true, rowsPerPage: 10);


@grid.GetHtml(tableStyle: "table",
        alternatingRowStyle: "alternate",
        headerStyle: "header",
        footerStyle: "footer",
        mode: WebGridPagerModes.FirstLast | WebGridPagerModes.NextPrevious,
        firstText: "Primeiro",
        previousText: "Anterior",
        nextText: "Próximo",
        lastText: "Último", columns: grid.Columns(
              grid.Column("Id", header: "Requisição", format: @<center><text>@item.Id</text></center>),
              grid.Column("Ano", header: "Ano", format: @<center><text>@item.Ano</text></center>),
              grid.Column("DataPortaria", header: "Data da Solicitação", format: @<center><text>@item.DataPortaria</text></center>),
              grid.Column("PessoaCadastrou", header: "Funcionário", format: @<center><text>@item.PessoaCadastrou</text></center>),
              grid.Column("TipoPortaria", header: "TipoPortaria", format: @<center><text>@item.IdTipoPortaria</text></center>),                        
              grid.Column("Assunto", header: "Assunto", format: @<center><text>@item.IdAssuntoPortaria</text></center>),
              grid.Column("Alterar", header: "Alterar", format: @<text><center>@Html.ActionLink("Analisar", "Analisar", new { id = item.Id })</center></text>),
              grid.Column("Excluir",   header: "Excluir",   format: @<text><center>@Html.ActionLink("Excluir", "Excluir", new { id = item.Id })</center></text>)
           )
);
}else{
<p>Nenhuma Portaria Pendente.</p>
}
